import { findCities } from '@/api/MaiZuo';

const changeCity = (payload = {}) => {
  return { type: 'change-city', payload };
};

// redux-thunk
const getCityList = () => {
  return (dispatch) => {
    findCities().then((res) => {
      dispatch({
        type: 'change-cityList',
        payload: res.cities,
      });
    });
  };
};

export { changeCity, getCityList };
